namespace Specifications
{
    //[TestFixture]
    //public class The_application_controller
    //{
    //    #region Setup/Teardown

    //    [SetUp]
    //    public void given_a_context_of()
    //    {
    //        _clientAdapter = MockRepository.GenerateStub<IClientAdapter>();
    //        _modelProcessor = MockRepository.GenerateStub<IModelProcessor>();
    //        _userSettings = MockRepository.GenerateStub<IUserSettings>();
    //        _presenter = new ApplicationModel(_clientAdapter, _modelProcessor,
    //                                                _userSettings, (a, b) => { });
    //    }

    //    #endregion

    //    private ApplicationModel _presenter;
    //    private IUserSettings _userSettings;

    //    [Test]
    //    public void raises_change_notification()
    //    {
    //        _presenter
    //            .AssertThatAllProperties()
    //            .RaiseChangeNotification();
    //    }

    //    [Test]
    //    public void uses_the_expected_presenter_by_default()
    //    {
    //        Assert.That(_presenter.CurrentPresenter, Is.InstanceOfType(typeof (FeedPresenter)));
    //    }

    //    [Test]
    //    public void can_refresh_the_home_feed()
    //    {
    //        var feed = Provide.AnExampleHomeFeed();

    //        _clientAdapter.Stub(x => x.FetchHomeFeed())
    //            .Return(feed);

    //        _presenter.RefreshHomeFeed();

    //        _modelProcessor.AssertWasCalled(x => x.ProcessFeed("home", feed));
    //    }

    //    [Test]
    //    public void exposes_the_presentation_model()
    //    {
    //        _modelProcessor.Stub(x => x.Model)
    //            .Return(new FeedCollection());

    //        Assert.That(_presenter.Model, Is.Not.Null);
    //    }

    //    [Test]
    //    public void exposes_the_user_settings()
    //    {
    //        Assert.That(_presenter.Settings, Is.Not.Null);
    //    }

    //    [Test]
    //    public void handles_an_authentication_exception()
    //    {
    //        _clientAdapter.Stub(x => x.FetchHomeFeed())
    //            .Throw(new WebException());

    //        Type presenter_type_expected = null;

    //        var controller = new ApplicationModel(_clientAdapter,
    //                                                   _modelProcessor,
    //                                                   _userSettings,
    //                                                   (type, action) => { presenter_type_expected = type; });
    //        controller.RefreshHomeFeed();

    //        Assert.That(presenter_type_expected, Is.EqualTo(typeof (ICredentialsPresenter)));
    //    }


    //    [Test]
    //    public void persists_the_settings_when_application_is_closed()
    //    {
    //        _presenter.Shutdown();

    //        _userSettings.AssertWasCalled(x => x.Save());
    //    }

    //    [Test]
    //    public void will_not_retry_after_an_authentication_exception_if_credential_request_fails()
    //    {
    //        _clientAdapter.Stub(x => x.FetchHomeFeed())
    //            .Throw(new WebException())
    //            .Repeat.Once();

    //        var controller = new ApplicationModel(_clientAdapter,
    //                                                   _modelProcessor,
    //                                                   _userSettings,
    //                                                   (type, action) => action(false));
    //        controller.RefreshHomeFeed();

    //        _modelProcessor.AssertWasNotCalled(
    //            x => x.ProcessFeed(Arg<string>.Is.Anything, Arg<Feed>.Is.Anything));
    //    }

    //    [Test]
    //    public void will_retry_after_an_authentication_exception_if_credential_request_succeeds()
    //    {
    //        _clientAdapter.Stub(x => x.FetchHomeFeed())
    //            .Throw(new WebException())
    //            .Repeat.Once();

    //        var controller = new ApplicationModel(_clientAdapter,
    //                                                   _modelProcessor,
    //                                                   _userSettings,
    //                                                   (type, action) => action(true));
    //        controller.RefreshHomeFeed();

    //        _modelProcessor.AssertWasCalled(
    //            x => x.ProcessFeed(Arg<string>.Is.Anything, Arg<Feed>.Is.Anything));
    //    }
    //}
}